﻿<UserControl x:Class="Agnes.Mainframe.OpenSlnView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:cal="http://www.caliburnproject.org"
             mc:Ignorable="d" 
             FontFamily="Microsoft YaHei"
             d:DesignHeight="800" d:DesignWidth="609" FontSize="14" >
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Agnes.Mainframe;Component/MainframeResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="30">
        <Grid.Resources>
            <Style x:Key="LineStyle" TargetType="{x:Type Path}">
                <Setter Property="Margin" Value="0,5,0,0" />
                <Setter Property="StrokeThickness" Value="2" />
                <Setter Property="Fill" Value="Black" />
                <Setter Property="Stroke" Value="LightGray" />
                <Setter Property="Data">
                    <Setter.Value>
                        <LineGeometry StartPoint="0,0" EndPoint="600,0" />
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TextBlock Text="打开解决方案" Grid.Row="0" FontSize="22"/>
        <Path Style="{StaticResource LineStyle}" Grid.Row="1" />
        <Button x:Name="OpenSln" Grid.Row="2" Margin="30,10,10,10" MinWidth="100" MinHeight="100"
                HorizontalAlignment="Left" >
            <Button.Template>
                <ControlTemplate>
                    <Border Style="{StaticResource NormalButtonStyle}" IsEnabled="{Binding ElementName=CreateNewSln, Path=IsEable}" >
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Image Source="pack://application:,,,/Agnes.Resources;Component/Image/Agnes.Mainframe/NewSln/New.png" Grid.Row="0" Width="80" Height="80" ></Image>
                            <TextBlock Grid.Row="1" Text="打开方案" Margin="5" HorizontalAlignment="Center" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Button.Template>
        </Button>
        <TextBlock Text="最近使用的解决方案" Grid.Row="3" FontSize="18" Foreground="Gray"/>
        <Path Style="{StaticResource LineStyle}" Grid.Row="4" />
        <ListBox Grid.Row="5" ItemsSource="{Binding Path=RecentlyUsedSlns}" 
                 SelectedItem="{Binding Path=SelectedUsedSln}"
                 cal:Message.Attach="[PreviewMouseDoubleClick]=[OpenRecentlySln()]"/>
    </Grid>
</UserControl>
